<?php
class OAuthMgr
{
    private static $auths = array();
    public static function getInstance($auth_channel)
    {
        if(!$auth_channel)
            $auth_channel = Yii::app()->session['auth_channel'];
        $classname = ucfirst(strtolower(trim($auth_channel))).'Auth';
        if(!preg_match('/^\w+$/i', $classname))
        {
            return false;
        }
        if(!isset(self::$auths[$classname]))
        {
            $classfile = __DIR__.'/oauth/'.$classname.'.php';
            if(!file_exists($classfile))
            {
                return false;
            }
            require $classfile;
            self::$auths[$classname] = new $classname;
        }
        return self::$auths[$classname];
    }

    function callback_auth(){}
    function auth_url(){}
    function get_authname(){}
    function set_access_token($token){}
    function get_remote_nickname(){}
}